<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="wangyuguo">
<title>安控POS管理</title>
<script language="javascript" type="text/javascript"
	src="/script/common.js"></script>

<script type="text/javascript">
			//全局变量
			var qt;
			function load() {
				Eui.showNavigation();
				setPages(["listview","detview"])
				createTable();
			}
			//创建数据表格
			function createTable(){
				var columns = []
				columns[0] = {type:"checkbox"}
				columns[5] = {title:"操作",width:"20",render:editFunc,align:"center",order:false}	
				qt = new QueryTable("hspos_list","","datalist",columns,{
					buttons:[
						{value:"增 加",actions:onNew},
						{value:"删 除",actions:onDelete}
					]
				});
				qt.showTable()
			}
			function editFunc(v,r){
				var id = r[0]
				return "<a href=# onclick='onNew("+id+",\""+r[1]+"\",\""+r[2]+"\")'>修 改</a>"
			}
			function onNew(id,ip,port) {
				if (id){
					var pos = {id:id,ipAddress:ip,port:port}
					Common.setValues("posform",pos);
				}
				switchPage("detview")
			}
			function onSave(){
				if (!checkForm("posform")) return;
				var pos = Common.getValues("posform")
				DWR.call("zhgjService.saveHSPos",pos,function(){
					showInformation("安控POS保存成功！");
					$("posform").reset();
					qt.showTable();
					switchPage("listview");
				});
			}
			function onDelete() {
				var ids = qt.getBoxValue()
				if (!ids)
					showWarning("请选择需要删除的安控POS。");
				else{
					if(showQuestion("是否删除这些安控POS？")){
						DWR.call("zhgjService.delHSPos",ids,function(){
							showInformation("删除成功！");
							qt.showTable();
						},{blockScreen:true});
					}
				}
			}
		</script>
</head>
<body onload="load()">
<!--页面导航-->
<div class="nav">
<div id="nav">&nbsp;</div>
</div>

<!--查询&列表-->
<div id="listview"><!--查询form-->
<div id="datalist"></div>
</div>
<div id="detview" style="display:none;">
	<form id="posform" name="posform" action="">
		<input type="hidden" name="id">
		<div class="form">
			<div class="formTitle">安控POS信息</div>
			<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="label4">
				<tr>
					<td>
						<label>IP地址</label> 
						<input type="text" name="ipAddress" onblur="checkV(this,'ip',true)"><span class="des" id="orgformspan">*</span>
					</td>
					<td>
						<label>端 口</label> 
						<input type="text" name="port" onblur="checkV(this,'int',true)"><span class="des" id="orgformspan">*</span>
					</td>
				</tr>
			</table>
		</div>
		<div align="center">
			<button type="button" name="savebt" onclick="onSave()">保 存</button>
			<button type="button" onclick="switchPage('listview')">取 消</button>
		</div>
	</form>
</div>
</body>
</html>